Ext.define('jwawa.erp.framework.JwawaResourceManager', {
    requires: ['Ext.util.HashMap'],
    singleton: true,

    constructor: function(config) {
        Ext.apply(this, config || {});
        this.all = new Ext.util.HashMap();
    },

    get : function(key) {
        return this.all.get(key);
    },

    register: function(key, item) {
        var all = this.all,
            key = (!key) ? all.getKey(item) : key;

        if (all.containsKey(key)) {
            Ext.Error.raise('Registering duplicate id "' + key + '" with this manager');
        }

        return this.all.add(key, item);
    },

//    add: function(key, item){
//        return this.all.add(key, item);
//    },

    replace: function(key, item){
        return this.all.replace(key, item);
    },

    unregister: function(key) {
        this.all.removeAtKey(key);
    },

    isRegistered : function(key){
        return this.all.containsKey(key);
    }
});

Ext.JwawaResMgr = jwawa.erp.framework.JwawaResourceManager;